home *** CD-ROM | disk | FTP | other *** search
- Path: airdmhor.gen.nz!not-for-mail
- From: gumboot@airdmhor.gen.nz (Simon Hosie)
- Newsgroups: comp.lang.c
- Subject: Re: division problem
- Date: 31 Jan 1996 06:52:58 +1300
- Organization: Airdmhor
- Message-ID: <4elltq$c6u@airdmhor.gen.nz>
- References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net>
- NNTP-Posting-Host: localhost.gen.nz
- X-Newsreader: TIN [version 1.2 PL2]
-
- gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
- > That's disgusting!
- > celcius = (fahrenheit - 32) * 5 / 9;
- Gene Wirchenko:
- > That's disgusting <g> as it doesn't round. Try it with 39 deg F:
- > (39-32)*5/9 ::= 7*5/9 ::= 35/9 ::= 3
- > but the actual value is 3.8... i.e. nearly 4. If you must int, 4
- > would be a better answer.
-
- celcius = ((fahrenheit - 32) * 10 + 9) / 18;
-
- But floating point doesn't round either.
-